package jui.business
{
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class QuickReplyManager extends EventDispatcher implements IJUIManager
	{
		[Bindable]
		public var inputText: String = "";
		
		[Bindable]
		public var inputPanelX: Number = 0;
		
		[Bindable]
		public var inputPanelY: Number = 0;
		
		[Bindable]
		public var inputPanelVisible: Boolean = false;
		
		public function cancelReply(): void
		{
			hideReplyPanel();
			clearInputText();
		}
		
		public function quickReplyById(replyId: String, x: Number, y: Number): void
		{
			clearInputText();
			setInputText("#" + replyId + " ");
			showReplyPanel(x, y);
		}

		/**
		 * Returns qualified class name used by ManagersFactory to produce this manager.
		 */
		public static function getQName(): String 
		{
			return "jui.business.QuickReplyManager";
		}
		
		private function showReplyPanel(x: Number, y: Number): void
		{
			inputPanelVisible = true;
			inputPanelX = x;
			inputPanelY = y;
		}
		
		private function hideReplyPanel(): void
		{
			inputPanelVisible = false;
		}
		
		private function clearInputText(): void
		{
			setInputText('');
		}
		
		public function setInputText(text: String): void
		{
			inputText = text;
		}
		
		public function QuickReplyManager(target:IEventDispatcher=null)
		{
			super(target);
		}
	}
}